package com.ruoyi.manage.mapper;

import com.ruoyi.manage.domain.UserDonation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ZhangZhongGen
 */
@Mapper
public interface UserDonationMapper {

    @Insert("insert into tb_user_donation(user_id, donation_id) values(#{userId}, #{donationId})")
    int insertUserDonation(UserDonation ud);


    List<UserDonation> selectUserDonationList(Long userId);

    @Delete("delete from tb_user_donation where user_id = #{userId} and donation_id = #{donationId}")
    int delete(UserDonation ud);

    @Select("select count(*) from tb_user_donation where user_id = #{userId} and donation_id = #{donationId}")
    int selectUserDonationByUD(UserDonation ud);
}
